package com.ghao.douban.job;

import com.ghao.douban.config.XxlJobConfig;
import com.ghao.douban.services.MovieInfoService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.time.LocalDateTime;

/**
 * @author Ghao
 * @date 2021/7/20 10:43
 */
@Component
public class Thief {

    @Autowired
    private MovieInfoService movieInfoService;

    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);

//    /**
//      * 每10s向豆瓣请求50条数据
//      * @author Ghao
//      * @date 2021/7/20 15:0
//      */
//    @Scheduled(cron = "0 0 12 * * ?")
//    public void StealFromDouban(){
//        movieInfoService.getMovieFromDouban();
//    }

    /**
     * 参数一 username 用户名
     * 参数二
     */
     @XxlJob(value = "helloXxlJob")
    public void helloXxlJob(){
        String jobParam = XxlJobHelper.getJobParam();
        logger.info(LocalDateTime.now().toString());
    }
}
